package com.yswl.pri.picture.entry;

import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.reflect.TypeToken;
import com.yswl.pri.common.utils.MResultUtil;

import org.json.JSONArray;
import org.json.JSONObject;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import yswl.com.klibrary.util.DateJsonDeserializer;

/**
 * Created by kangpAdministrator on 2018/4/27 0027.
 * Emial kangpeng@yunhetong.net
 */

public class XiImageBean {

    /**
     * width : 162
     * id : 9f8952bc-4b13-41c1-8f4d-ac21b8a5871f
     * image : http://or6on57t6.bkt.clouddn.com/uploads/photo/image/9f8952bc-4b13-41c1-8f4d-ac21b8a5871f/image.jpg_orig?imageView2/2/w/324
     * large_image : http://or6on57t6.bkt.clouddn.com/uploads/photo/image/9f8952bc-4b13-41c1-8f4d-ac21b8a5871f/image.jpg_orig?imageMogr/v2/thumbnail/565>
     * large_width : 2048
     * large_height : 1536
     */
    public static ArrayList<XiImageBean> jsonToList(JSONObject json) {
        JSONArray objarray = MResultUtil.getArrayObjDATA(json, "result");
        if (objarray == null || objarray.length() <= 0) return null;
        Gson gson = new GsonBuilder().registerTypeAdapter(Date.class, new DateJsonDeserializer()).create();
        ArrayList<XiImageBean> list = gson.fromJson(objarray.toString(), new TypeToken<List<XiImageBean>>() {
        }.getType());
        return list;
    }

    private int width;
    private String id;
    private String image;
    private String large_image;
    private int large_width;
    private int large_height;

    public int getWidth() {
        return width;
    }

    public void setWidth(int width) {
        this.width = width;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getImage() {
        return image;
    }

    public void setImage(String image) {
        this.image = image;
    }

    public String getLarge_image() {
        return large_image;
    }

    public void setLarge_image(String large_image) {
        this.large_image = large_image;
    }

    public int getLarge_width() {
        return large_width;
    }

    public void setLarge_width(int large_width) {
        this.large_width = large_width;
    }

    public int getLarge_height() {
        return large_height;
    }

    public void setLarge_height(int large_height) {
        this.large_height = large_height;
    }
}
